package com.sugon.controller;

import com.sugon.entity.Demo;
import com.sugon.entity.ModifyAfter;
import com.sun.org.apache.bcel.internal.generic.RETURN;
import lombok.Value;
import lombok.extern.slf4j.Slf4j;
import org.springframework.validation.BindingResult;
import org.springframework.web.bind.annotation.PatchMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;

import javax.validation.Valid;
import java.math.BigDecimal;

/**
 * @author luoyuan
 * @create 2018-11-19-下午10:30
 */
@RequestMapping("/user")
@Slf4j
public class UserController {

    @PatchMapping("/regist")
    public String regist(@Valid @RequestBody Demo demo,
                         BindingResult bindingResult) {
        if (bindingResult.hasErrors()) {
            log.error("[用户注册] 参数不正确,form:{},message:{}", demo, bindingResult.getFieldError().getDefaultMessage());
            return bindingResult.getFieldError().getDefaultMessage();
        }
        return "success";
    }



}
